/*****************************************************************************
 *
 *                      HUSONG PROPRIETARY INFORMATION
 *
 *          The information contained herein is proprietary to HUSONG
 *           and shall not be reproduced or disclosed in whole or in part
 *                    or used for any design or manufacture
 *              without direct written authorization from HUSONG.
 *
 *            Copyright (c) 2015 by HUSONG.  All rights reserved.
 *
 *****************************************************************************/
package me.send.produce.client.controller;

import java.util.List;

import me.send.business.service.bean.ReturnJsonBean;
import me.send.business.service.pojo.Message;
import me.send.business.service.service.MessageService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author maxmin
 *
 * @date 2015年8月31日 下午3:20:14
 */
@Controller
@RequestMapping(value = "message")
public class MessageController {

	@Autowired
	MessageService messageService;

	/**
	 * 获取消息列表
	 * 
	 * @param userid
	 * @param devicenumber
	 * @return
	 * @author maxmin
	 * @date 2015年8月31日下午4:46:01
	 */
	@RequestMapping(value = "list")
	@ResponseBody
	public ReturnJsonBean getMessages(int userid, String devicenumber,
			int type, Long startid, int size) {
		ReturnJsonBean rb = new ReturnJsonBean();
		try {
			List<Message> list = messageService.getMessagese(userid, startid,
					type, size);
			rb.setCode(ReturnJsonBean.SUCCESS);
			rb.setMessage(ReturnJsonBean.SUCCESS_STR);
			rb.setDatas(list);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return rb;
	}

}
